<?php


namespace Tbf\Bundle\ImageBundle\Verify;


use Symfony\Component\HttpFoundation\Response;

class VerifyResponse{
    /**
     * @var string
     */
    protected $code_hash;
    /**
     * @var string
     */
    protected $image_content;
    /**
     * @var string
     */
    protected $image_content_type;

    /**
     * @param $code
     * @return $this
     */
    public function setPlainCode($code){
        $this->code_hash = hash('sha512',strtoupper($code));
        return $this;
    }
    /**
     * @param string $code_hash
     */
    public function setCodeHash($code_hash)
    {
        $this->code_hash = $code_hash;
    }

    /**
     * @return string
     */
    public function getCodeHash()
    {
        return $this->code_hash;
    }

    /**
     * @param string $image_content
     */
    public function setImageContent($image_content)
    {
        $this->image_content = $image_content;
    }

    /**
     * @return string
     */
    public function getImageContent()
    {
        return $this->image_content;
    }

    /**
     * @return Response
     */
    public function getResponse(){
        $resp = new Response();
        $resp->headers->set('Content-type',$this->getImageContentType());
        $resp->setContent($this->getImageContent());

        return $resp;
    }

    /**
     * @param string $image_content_type
     */
    public function setImageContentType($image_content_type)
    {
        $this->image_content_type = $image_content_type;
    }

    /**
     * @return string
     */
    public function getImageContentType()
    {
        return $this->image_content_type;
    }

}